﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Register.Command;
using Register.DALFactory;
using  Register.IDAL;
using Register.Model;
namespace Register.BLL
{
    /// <summary> 
    /// FileName: HospitalInstall.cs    
    /// CLRVersion: 4.0.30319.269    
    /// Author: DoubleZ    
    /// Corporation:     
    /// Description:     
    /// DateTime: 2012/7/6 10:18:24    
    /// </summary>
 public  class HospitalInstallBLL
 {
     private static string typeNameKey = "IHospitalInstallDALKey";
     #region 添加医院配置
     public static bool AddHospitalInstall(HospitalInstall model)
     {
         IHospitalInstallDAL iHospitalInstall = DALFactory<IHospitalInstallDAL>.Create(typeNameKey);
         try
         {
             if (iHospitalInstall.AddHospitalInstall(model)> 0)
                 return true;
             else
                 return false;
         }
         catch (Exception e)
         {
             LogRecordHelper.LogNote("ERROR", e.Message);
             throw e;
         }
     }
     #endregion
     #region 获取配置信息
     public static List<Model.HospitalInstall> GetPagedHospitalInstall(int size, int pageIndex, string where)
     {
         IHospitalInstallDAL iHospitalInstall = DALFactory<IHospitalInstallDAL>.Create(typeNameKey);
         try
         {
             return iHospitalInstall.GetPagedHospitalInstall(size, pageIndex, where);
         }
         catch (Exception e)
         {
             LogRecordHelper.LogNote("ERROR", e.Message);
             throw e;
         }
     }
     public static int GetHospitalInstallCount(string where)
     {
         IHospitalInstallDAL iHospitalInstall = DALFactory<IHospitalInstallDAL>.Create(typeNameKey);

         try
         {
             return iHospitalInstall.GetHospitalInstallCount(where);
         }
         catch (Exception e)
         {
             LogRecordHelper.LogNote("ERROR", e.Message);
             throw e;
         }
     }
     #endregion
     #region 根据医院ID获取医院名称
     public static string GetHospitalNameById(string hospitalID)
     {
         IHospitalInstallDAL iHospitalInfo = DALFactory<IHospitalInstallDAL>.Create(typeNameKey);
         try
         {
             return iHospitalInfo.GetHospitalNameById(hospitalID);

         }
         catch (Exception e)
         {
             LogRecordHelper.LogNote("ERROR", e.Message);
             throw e;
         }
     }
     #endregion
     #region 删除医院配置
     public static bool DeleteHospitalInstall(string hospitalInstallID)
     {
         IHospitalInstallDAL ihospitalInstall = DALFactory<IHospitalInstallDAL>.Create(typeNameKey);
         try
         {
             if (ihospitalInstall.DeleteHospitalInstall(hospitalInstallID) > 0)
                 return true;
             else
                 return false;
         }
         catch (Exception e)
         {
             LogRecordHelper.LogNote("ERROR", e.Message);
             throw e;
         }
     }
     #endregion
     #region 更新配置
     public static bool UpdateHospitalInstall(Model.HospitalInstall model)
     {
         IHospitalInstallDAL iHospitalInstall = DALFactory<IHospitalInstallDAL>.Create(typeNameKey);
         try
         {
             if (iHospitalInstall.UpdateHospitalInstall(model)> 0)
             {
                 return true;
             }
             else
                 return false;
         }
         catch (Exception e)
         {
             LogRecordHelper.LogNote("ERROR", e.Message);
             throw e;
         }
     }

     #endregion
 }
}
